package screen.component
{
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.net.URLRequest;
	
	import helper.ValueObject;
	
	import screen.TechComBankScreen;

	public class Help extends Popup
	{
		private const _TUTO_NO:Number = 2;
		private const _TUTORIAL_UNIT_WIDTH:Number = 440;
		private const _TUTORIAL_AVATAR_FOLDER:String = "../assets/tutorial/";
		private var _tech_com_bank_screen:TechComBankScreen;
		private var _tutorial_group:MovieClip;
		public function Help()
		{
			init();
		}
		private function init():void{
			_tech_com_bank_screen = TechComBankScreen.getInstance();
			_popup = ValueObject.T1_RESOURCE.getExportedAsset("helpPopup") as MovieClip;
			popupInit(_popup);
			_tutorial_group = new MovieClip;
			_popup.addChild(_tutorial_group);
			with(_popup){
				_tutorial_group.x = maskMc.x;
				_tutorial_group.y = maskMc.y;
				_tutorial_group.mask = maskMc;
				sliderInit(_tutorial_group,1,1,_tutorial_group.x,_TUTORIAL_UNIT_WIDTH);
				buttonImageInit(nextBtn);
				MovieClip(nextBtn).addEventListener(MouseEvent.CLICK,nextTutoHandle);
				buttonImageInit(preBtn);
				MovieClip(preBtn).addEventListener(MouseEvent.CLICK,preTutoHandle);
			}
			for(var i:Number=1;i<=_TUTO_NO;i++){
				var tutorial_unit:MovieClip = ValueObject.T1_RESOURCE.getExportedAsset("tutorialUnit") as MovieClip;
				tutorial_unit.avatar.load(new URLRequest(_TUTORIAL_AVATAR_FOLDER + "guide" + i + ".png"));
				tutorial_unit.x = (i-1)*_TUTORIAL_UNIT_WIDTH;
				_tutorial_group.addChild(tutorial_unit);
			}
			updateSliderBtn(_tutorial_group);
			
		}
		private function nextTutoHandle(e:MouseEvent):void{
			sliderNextClick(_tutorial_group);
		}
		private function preTutoHandle(e:MouseEvent):void{
			sliderPreClick(_tutorial_group);
		}
	}
}